﻿using System;
using UnityEngine;

namespace ShootingEditor2D
{
    public class Bullet : MonoBehaviour
    {
        private Rigidbody2D _rigidbody2D;
        
        private void Awake()
        {
            _rigidbody2D =  GetComponent<Rigidbody2D>();
        }

        private void Start()
        {
            _rigidbody2D.velocity = Vector2.right * 10;
        }

        private void OnCollisionEnter2D(Collision2D other)
        {
            if (other.gameObject.CompareTag("Enemy"))
            {
                Destroy(other.gameObject);
            }
        }
    }

}